<template>
  <div class="container">
    <a-button type="primary" @click="goToClass">goToClass</a-button>
    <br />
    <br />
    <a-button type="primary" @click="testMitt">testMitt</a-button>
  </div>
</template>

<script lang="ts" setup>
import {reactive, ref, onMounted, onUnmounted, defineAsyncComponent} from "vue";
import mittBus from "@/utils/route-listener"

import { useRouter } from "vue-router";
const router = useRouter();

const goToClass = ()=>{
  router.push({name: 'class', params :{} })
}
const testMitt = ()=>{
  mittBus.emit("test", {msg : "hello"})
}

onMounted(()=>{
  mittBus.on('test', (data)=>{
    console.log("mitt test " + data.msg)
    alert("mitt test " + data.msg)
  })
})
</script>

<style scoped>

</style>
